home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 37 / CD Expert nº 37.iso / LastCall / lastcall.exe / stuff / lastcall.dxr / 00140_Sound Level volume Slider.ls < prev    next >
Encoding:
Text File  |  2000-03-27  |  699 b   |  37 lines

  1. property pSpr, pMinLeft, pMaxRight
  2.  
  3. on beginSprite me
  4.   pSpr = sprite(me.spriteNum)
  5.   pMinLeft = 359
  6.   pMaxRight = 450
  7.   mUpdate(me)
  8. end
  9.  
  10. on mUpdate me
  11.   percent = getVolumePercent()
  12.   pSpr.locH = pMinLeft + (percent * (pMaxRight - pMinLeft))
  13. end
  14.  
  15. on mouseDown me
  16.   repeat while the stillDown
  17.     pSpr.locH = min(max(pMinLeft, the mouseH), pMaxRight)
  18.     updateStage()
  19.   end repeat
  20. end
  21.  
  22. on mouseUp me
  23.   mid = pSpr.locH - pMinLeft
  24.   percent = float(mid) / (pMaxRight - pMinLeft)
  25.   setVolumePercent(percent)
  26.   mUpdateVolumeSlider(me)
  27. end
  28.  
  29. on mUpdateVolumeSlider me
  30.   global gMuteAllSounds
  31.   if gMuteAllSounds then
  32.     toggleMute(1)
  33.   end if
  34.   mUpdate(me)
  35.   playBeepSound(getVolumePercent() * 255)
  36. end
  37.